package action;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ModelDriven;

import entity.UserBean;

/**
 * @author dingyuanwei
 * @version 建立時間：Dec 28, 20109:19:59 AM
 * 類別說明:使用模型驱动
 */
public class LoginMDAction implements Action, ModelDriven<UserBean> {

	UserBean ub= new UserBean();
	public String execute() throws Exception {
		if(getModel().getUsername().equals("1")){
			getModel().setTip("哈哈，服务器提示");
			return Action.SUCCESS;
		}else if(getModel().getUsername().equals("2")){
			return Action.ERROR;
		}else{
			 throw new java.lang.Exception("sql异常信息");
		}
	}

	public UserBean getModel() {
		
		return ub;
	}

}
